// import P06 from './P06';
import get from '@dfeidao/atom-web/local/get';
import set from '@dfeidao/atom-web/local/set';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import { IFeidaoAiBrowserComponent } from '@dfeidao/web/interfaces';
import hide_loading from '../../atom/hide-loading';
import show_loading from '../../atom/show-loading';
import P01 from './P01';
import P04 from './P04';
import P05 from './P05';
export default async function a020(fd: IFeidaoAiBrowserComponent, role_no: string, ff: string) {
	//  调用事件
	// const role_no = role_no;
	set(fd, 'role_no', role_no);
	// debugger;
	const productid = get(fd, 'productid');
	const page_no = 1;
	const page_size = get(fd, 'page_size') as number;
	// debugger;
	show_loading();
	const res = await nodejs<{ dataArray: object[], count: number, page_no: number, page_size: number }>('roler/service/pub_role_allot_find', { productid, role_no, page_no, page_size });
	hide_loading();
	if (res.count === 0) {
		render(fd, '', P01, 'P01', 'inner');
		fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="P05"]').innerHTML = '';
		render(fd, '', P04, 'P04', 'inner');
	} else {
		render(fd, res.dataArray, P01, 'P01', 'inner');
		res.page_no = page_no;
		res.page_size = page_size;
		set(fd, 'page_size', page_size);
		fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="P04"]').innerHTML = '';
		render(fd, res, P05, 'P05', 'inner');
		if (ff) {
			const id = ff;
			const items = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-id1="' + id + '"]');
			set_node_cls(items, 'bg-c', true);
			set(fd, 'role_allot_id', items.getAttribute('data-feidao-id1'));
			set(fd, 'pk_val', items.getAttribute('data-feidao-pk_val'));
		}
	}
}
